package cool.taomu.toolkit.kademlia.entity

import org.eclipse.xtend.lib.annotations.Accessors
import org.eclipse.xtend.lib.annotations.ToString
import org.eclipse.xtend.lib.annotations.EqualsHashCode
import cool.taomu.toolkit.kademlia.thrift.Node

@Accessors
@ToString
@EqualsHashCode
class KademliaNode {
	String id;
	String host;
	int port;
	int offline;
	// 节点被获取
	long timestamp;
	// 节点第一次加入的
	long createTimestemp;

	new(Node node) {
		this(node.id, node.host, node.port, 0, 0)
	}

	new(String id, String host, int port, int offline, long createTimestemp) {
		this.id = id;
		this.host = host;
		this.port = port;
		this.offline = offline;
		this.createTimestemp = timestamp;
	}

	new() {
	}
	def toNode(){
		new Node(this.id,this.host,this.port,0,0);
	}
}
